class User(object):
    def __init__(self,name='两点水',sex='男'):
        self.sex = sex
        self.name = name

    def __get__(self,obj,objtype):
        print('获取 name值')
        return self.name

    def __set__(self,obj,val):
        print('设置 name 值')
        self.name = val

class MyClass(object):
    x = User('两点水','男')
    y = 5
if __name__ == '__main__':
    m = MyClass()
    print(m.x)

    print('\n')

    m.x = '三点水'
    print(m.x)

    print('\n')

    print(m.x)

    print('\n')

    print(m.y)